/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.tnmk.worktime.service.model;

import org.joda.time.DateTime;
import org.tnmk.worktime.service.CalculatorService;
import org.tnmk.worktime.service.dao.entry.SessionEntry;
import org.tnmk.worktime.service.dao.entry.SessionType;
import org.tnmk.worktime.service.dao.entry.SpendEntry;
import org.tnmk.worktime.service.model.xmladapter.ListWrapper;

/**
 *
 * @author Administrator
 */
public class SessionModel {

  private final SessionEntry daoData;
  private float weekWorkedHours;
  private float monthWorkedHours;
  private long sumSpend;
  private long sumWeekSpend;
  private long sumMonthSpend;

  public SessionModel() {
    super();
    daoData = new SessionEntry();
  }

  /**
   * @param session all properties of session will be copied to this session
   */
//  @SuppressWarnings("LeakingThisInConstructor")//Only used for BeanUtils.copyProperties(...)
  public SessionModel(SessionEntry session) {
    this.daoData = session;
//    BeanUtils.copyProperties(session, this);
  }

  public float getWeekWorkedHours() {
    return weekWorkedHours;
  }

  public void setWeekWorkedHours(float weekWorkedHours) {
    this.weekWorkedHours = weekWorkedHours;
  }

  public float getMonthWorkedHours() {
    return monthWorkedHours;
  }

  public void setMonthWorkedHours(float monthWorkedHours) {
    this.monthWorkedHours = monthWorkedHours;
  }

  public long getSumSpend() {
    return sumSpend;
  }

  public void setSumSpend(long sumSpend) {
    this.sumSpend = sumSpend;
  }

  public long getSumMonthSpend() {
    return sumMonthSpend;
  }

  public void setSumMonthSpend(long sumMonthSpend) {
    this.sumMonthSpend = sumMonthSpend;
  }

  public long getSumWeekSpend() {
    return sumWeekSpend;
  }

  public void setSumWeekSpend(long sumWeekSpend) {
    this.sumWeekSpend = sumWeekSpend;
  }

  public SessionEntry getDaoData() {
    return daoData;
  }

  ///////////////////////////////////////////////////////////////////////////////
  public void setOutTime(DateTime time) {
    this.daoData.setOutTime(time);
  }

  public DateTime getOutTime() {
    return this.daoData.getOutTime();
  }

  public void setInTime(DateTime time) {
    this.daoData.setInTime(time);
  }

  public DateTime getInTime() {
    return this.daoData.getInTime();
  }

  public void setNote(String note) {
    this.daoData.setNote(note);
  }

  public String getNote() {
    return this.daoData.getNote();
  }

  public DateTime getExpectedOutTime() {
    return this.daoData.getExpectedOutTime();
  }

  public float getMustWorkHoursToday() {
    return this.daoData.getMustWorkHoursToday();
  }

  public DateTime getBreakBeginTime() {
    return this.daoData.getBreakBeginTime();
  }

  public DateTime getBreakEndTime() {
    return this.daoData.getBreakEndTime();
  }

  public float getWorkedHours() {
    return this.daoData.getWorkedHours();
  }

  public ListWrapper<SpendEntry> getMoneySpend() {
    return this.daoData.getMoneySpend();
  }

  public Integer getId() {
    return this.daoData.getId();
  }

  public SessionType getType() {
    return this.daoData.getType();
  }

  public void setType(SessionType type) {
    this.daoData.setType(type);
  }

  public boolean isWorkDay() {
    return CalculatorService.isWorkDay(daoData);
  }
}
